#!/usr/bin/perl -w

use strict;
use utf8;

my %vis = (
    0 => '.',
    1 => 'o',
    2 => '□',
    3 => 'Δ',
    4 => 'X',
    5 => '#'
);

my $bpp = 3;
my $w = 5;
my $h = 4;

while (<>)
{
    print;
    if (my ($str) = /([01]{9,})/)
    {
        my @s = split '', $str;
        for (my $i = 0; $i < $h; ++$i)
        {
            for (my $j = 0; $j < $w; ++$j)
            {
                my $val = 0;
                my $k = 1;
                for (my $b = 0; $b < $bpp; ++$b)
                {
                    $val += $k * $s[$w*$i*$bpp+$j*$bpp+$b];
                    $k = 2*$k;
                }
		if (defined $vis{$val})
		{
                	print $vis{$val} . ' ';
		}
		else
		{
                	print $val . ' ';
		}
            }
            print "\n";
        }
        print "\n";
    }
}
